// Copyright 2022 a.o.smith ALL Rights Reserved
package com.liuxinlong.enums;

import org.apache.commons.lang3.StringUtils;

/**
 * 变更类型枚举
 *
 * @author liuxinlong@hotwater.com.cn
 * @version 1.0.0
 * @since 2022-03-07
 */
public enum ChangeCategoryTypeEnum {
    NEW_MATERIAL(1, "物料发布","NEW-物料"),
    NEW_PRODUCT(2, "产品发布","NEW-产品"),
    REV_DRAWING(3, "图纸更改","REV-图纸"),
    ADD_BOM(4, "bom增加","ADD-BOM"),
    EXP_BOM(5, "bom删除","EXP-BOM"),
    NEW_BOM(6, "bom发布","新BOM导入"),
    NEW_WORK_HOUR(7, "工时发布","NEW-工时"),
    ADD_WORK_HOUR(8, "工时增加","ADD-工时"),
    EXP_WORK_HOUR(9, "工时删除","EXP-工时"),
    ADD_IMAGINARY(10, "虚项增加","ADD-虚项"),
    EXP_IMAGINARY(11, "虚项删除","EXP-虚项"),
    NEW_TECHNICAL_DOCUMENT(12, "技术文件发布","NEW-技术文件"),
    REV_TECHNICAL_DOCUMENT(13, "技术文件更改","REV-技术文件"),
    NEW_SOP(14, "工艺文件发布","NEW-SOP"),
    REV_SOP(15, "工艺文件更改","REV-SOP"),
    REV_CCC(16, "3C更改","REV-CCC"),
    REV_PRODUCT_POSITION(17, "定位更改","REV-产品定位"),
    REV_PRODUCT_SERIES(18, "系列更改","REV-产品系列"),
    REV_PRODUCT_LINE(19, "产品线更改","REV-产品线"),
    REV_PRODUCT_MODEL(20, "型号更改","REV-产品型号"),
    REV_UNIT(21, "单位更改","REV-单位"),
    REV_SUPPLIER(22, "供应商更改","REV-供应商"),
    REV_MARKET_AREA(23, "可销更改","REV-可销地区"),
    REV_DESC1(24, "描述1更改","REV-描述1"),
    REV_DESC2(25, "描述2更改","REV-描述2"),
    REV_BATCH(26, "批量更改","REV-批量"),
    REV_DIGIT_CODE(27, "四位码更改","REV-四位码"),
    REV_PMCODE(28, "制购类更改","REV-制购类"),
    REV_STATUS(29, "状态更改","REV-状态"),
    REV_STOCK(30, "库存","库存相关"),
    ADD_DEV(31, "代用增加","ADD-DEV"),
    EXP_DEV(32, "代用删除","EXP-DEV");

    private int value;

    private String name;

    private String category;

    ChangeCategoryTypeEnum(int value, String name,String category) {
        this.value = value;
        this.name = name;
        this.category = category;
    }

    public int getValue() {
        return value;
    }

    public String getName() {
        return name;
    }

    public String getCategory() {
        return category;
    }

    public static String getNameByValue(int value) {
        ChangeCategoryTypeEnum arrObj[] = ChangeCategoryTypeEnum.values();
        for (ChangeCategoryTypeEnum obj : arrObj) {
            if (value == obj.getValue()) {
                return obj.getName();
            }
        }
        return "其他变更";
    }

    public static int getValueByCategory(String category) {
        ChangeCategoryTypeEnum arrObj[] = ChangeCategoryTypeEnum.values();
        for (ChangeCategoryTypeEnum obj : arrObj) {
            if (StringUtils.equals(category,obj.getCategory())) {
                return obj.getValue();
            }
        }
        return 0;
    }
}
